import { fileURLToPath, URL } from "node:url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
// import { admin_url } from "@/config/sever";
import { admin_url } from "./src/config/sever.js";
// https://vite.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": fileURLToPath(new URL("./src", import.meta.url)),
    },
  },
  server: {
    proxy: {
      "/app/": {
        target: admin_url + "/app/",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/app/, ""), // 重写路径
      },
    },
  },
});
